import os
srcFile = '/home/aiserver/keras-yolo3-master/VOCdevkit/VOC2007/Annotations/'
#dstFile = '/home/aiserver/keras-yolo3-master/VOCdevkit/VOC2007/JPEGImages/'


def delete_space():
    for file in os.listdir(srcFile):
        print(file.replace(' ', ''))
        os.rename(os.path.join(srcFile,file),os.path.join(srcFile,file.replace(' ', '')))


def rename(path):

    i = 1
    for file in os.listdir(path):
        NewName = os.path.join(path, str(i) + ".jpg")
        OldName = os.path.join(path, file)
        os.rename(OldName, NewName)
        i += 1

if __name__ == '__main__':


    path = './test'
    rename(path)